<template>
  <div>
      <p class="map">{{this.cityname}}疫情地图</p>
      <br>
     <div id="new" style="width: 100%; height: 700px"></div>
  </div>
</template>

<script>
  export default {
    props:['cityname'],
     data() {
    return {
      active: 0,
      list:[]
    };
  },
  created(){
    this.getInformation();
  },

  methods: {

    getInformation(){
      // that = this
      this.$jsonp(
        'https://interface.sina.cn/news/wap/fymap2020_data.d.json'
        )
          .then((res) => {
            // console.log(res)
            let Arr1 = [];

            res.data.list.forEach(item=>{

                if( item.name == this.cityname){

                  item.city.forEach(con =>{
                     let nowObj={}
                    nowObj.name = con.name;
                    nowObj.value = con.econNum;
                    Arr1.push(nowObj)
                  })
                }
                // console.log(this);
                // Arr1.push(nowObj)

            })
            // console.log(Arr1);

            this.$myChart.cityMap("new",this.cityname,Arr1);
            // console.log(this.cityname);
            // this.$myChart.chinaMap("cur",Arr2);
          })
          .catch((err) => {
            console.log(err)
          })
  },
  }
  }
</script>

<style lang="less" scoped>
.map{
  text-align: center;
  font-size: larger;
  color: #666;
}
</style>
